home *** CD-ROM | disk | FTP | other *** search
/ Aminet 43 / Aminet 43 (2001)(GTI - Schatztruhe)[!][Jun 2001].iso / Aminet / dev / moni / SystemViewer.lha / Source / GlobalObjects / CommonFuncs.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-04-03  |  6.0 KB  |  204 lines

  1. /****h* CommonFuncs/CommonFuncs.h **********************************
  2. *
  3. * NAME
  4. *    CommonFuncs.h - the #include file for CommonFuncs.o usage.
  5. * DESCRIPTION
  6. *    See CommonFuncs.c file for documentation.
  7. ********************************************************************
  8. *
  9. */
  10.  
  11. #ifndef  COMMONFUNCS_H
  12. # define COMMONFUNCS_H 1
  13.  
  14. # ifndef STDIO_H
  15. #  include <stdio.h> 
  16. # endif
  17.  
  18. # ifndef WORKBENCH_WORKBENCH_H
  19. #  include <workbench/workbench.h>
  20. # endif 
  21.  
  22. # ifndef INTUITION_INTUITION_H
  23. #  include <intuition/intuition.h>
  24. # endif 
  25.  
  26. # ifndef LIBRARIES_DISKFONT_H
  27. #  include <libraries/diskfont.h>
  28. # endif 
  29.  
  30. # ifndef LIBRARIES_ASL_H
  31. #  include <libraries/asl.h>
  32. # endif 
  33.  
  34. struct ColorCoords {
  35.  
  36.    LONG Red_Hue;
  37.    LONG Green_Saturation;
  38.    LONG Blue_Luminance;    
  39. };
  40.  
  41. struct CompFont {
  42.  
  43.    UWORD FontX, FontY; // Font X & Y sizes.
  44.    UWORD OffX,  OffY;  // Font X & Y offsets.
  45. };
  46.  
  47. struct ListViewMem {
  48.     
  49.    UBYTE       *lvm_NodeStrs;
  50.    struct Node *lvm_Nodes;
  51.    int          lvm_NumItems;
  52.    int          lvm_NodeLength;
  53. };
  54.  
  55. IMPORT int LVMError;             // Communication flag - Guarded_AllocLV().
  56.  
  57. # define  LVM_ERROR_NONE       0 // Values for LVMError
  58. # define  LVM_ERROR_WRONG_SIZE 1
  59. # define  LVM_ERROR_NOMEM      2
  60.  
  61.  
  62. # define  INTUITIONLIB   0x00000001  // OpenLibs() & CloseLibs() flags
  63. # define  GRAPHICSLIB    0x00000002  // NOT currently used.
  64. # define  EXECLIB        0x00000004
  65. # define  DOSLIB         0x00000008
  66. # define  LAYERSLIB      0x00000010
  67. # define  IFFPARSELIB    0x00000020
  68. # define  UTILITYLIB     0x00000040
  69. # define  COMMODITIESLIB 0x00000080
  70. # define  ASLLIB         0x00000100
  71. # define  DISKFONTLIB    0x00000200
  72. # define  AMIGAGUIDELIB  0x00000400
  73. # define  GADTOOLSLIB    0x00000800
  74.  
  75. // RawKey values:
  76.  
  77. # define  F1             80
  78. # define  F2             81
  79. # define  F3             82
  80. # define  F4             83
  81. # define  F5             84
  82. # define  F6             85
  83. # define  F7             86 
  84. # define  F8             87
  85. # define  F9             88
  86. # define  F10            89
  87.  
  88. # define  HELP           95
  89.  
  90. # define  LEFT_ARROW     79
  91. # define  RIGHT_ARROW    78
  92. # define  UP_ARROW       76
  93. # define  DOWN_ARROW     77
  94.  
  95. // -------- Function protos: -------------------------------------------
  96.  
  97. PUBLIC int  OpenLibs(  void );
  98. PUBLIC void CloseLibs( void );
  99.  
  100. PUBLIC void SetupList( struct List *list, struct ListViewMem *lvm );
  101.  
  102. PUBLIC void Guarded_FreeLV( struct ListViewMem *lvm );
  103.  
  104. PUBLIC struct ListViewMem *Guarded_AllocLV( int numitems, int itemsize );
  105.  
  106. PUBLIC void ReportAllocLVError( void );
  107.  
  108. // ---------------------------------------------------------------------
  109.  
  110. PUBLIC void HideListFromView( struct Gadget *lv, struct Window *w );
  111.  
  112. PUBLIC void ModifyListView( struct Gadget *lv, 
  113.                             struct Window *w,
  114.                             struct List   *list,
  115.                             struct Gadget *strgadget
  116.                           );
  117.  
  118. // ---------------------------------------------------------------------
  119.  
  120. PUBLIC struct Screen *GetActiveScreen( void );
  121.  
  122. PUBLIC ULONG getScreenModeID( struct TagItem *taglist, 
  123.                               struct Screen  *scr,
  124.                               char           *title 
  125.                             );
  126.  
  127. PUBLIC int File_DirReq( char           *filename, 
  128.                         char           *dirname, 
  129.                         struct TagItem *taglist
  130.                       );
  131.  
  132. PUBLIC int FileReq( char *filename, struct TagItem *taglist );
  133.  
  134. PUBLIC char *GetPathName( char *path, char *filename, int size );
  135.  
  136. // ---------------------------------------------------------------------
  137.  
  138. /* SetNotifyWindow() has to be called BEFORE you use User Requesters,
  139. ** like Handle_Problem(), or they will not work!
  140. */
  141.  
  142. PUBLIC void SetNotifyWindow( struct Window *wptr       );
  143. PUBLIC void SetReqButtons(   char          *newbuttons );
  144.  
  145. PUBLIC void UserInfo(        char *message, char *windowtitle );
  146. PUBLIC int  Handle_Problem(  char *info, char *title, int *errnum );
  147. PUBLIC int  GetUserResponse( char *info, char *title, int *errnum );
  148. PUBLIC BOOL SanityCheck(     char *question );
  149.  
  150. PUBLIC void DisplayTitle(    struct Window *wptr, char *txt );
  151.  
  152. // ---------------------------------------------------------------------
  153.  
  154. PUBLIC int   FontXDim( struct TextAttr *font );
  155. PUBLIC UWORD ComputeX( UWORD fontxsize, UWORD value );
  156. PUBLIC UWORD ComputeY( UWORD fontysize, UWORD value );
  157.  
  158. PUBLIC void ComputeFont( struct Screen   *Scr, 
  159.                          struct TextAttr *Font,
  160.                          struct CompFont *cf,
  161.                          UWORD            width, 
  162.                          UWORD            height
  163.                        );
  164.  
  165. // ---------------------------------------------------------------------
  166.  
  167. PUBLIC char **FindTools( struct DiskObject *diskobj, 
  168.                          char              *name, 
  169.                          BPTR               lock 
  170.                        );
  171.  
  172. PUBLIC char *GetToolStr( char **toolptr, char *name, char *deflt );
  173. PUBLIC int   GetToolInt( char **toolptr, char *name, int defaultvalue );
  174.  
  175. PUBLIC BOOL GetToolBoolean( char **toolptr, char *name, int defaultBool );
  176.  
  177. PUBLIC void *FindIcon( void              *(ToolProc)( char ** ), 
  178.                        struct DiskObject *dobj,
  179.                        char              *pgmname
  180.                      );
  181.  
  182. // ---------------------------------------------------------------------
  183.  
  184. PUBLIC struct ColorCoords *RGB2HSV( struct ColorCoords *input );
  185. PUBLIC struct ColorCoords *HSV2RGB( struct ColorCoords *input );
  186.  
  187. // ---------------------------------------------------------------------
  188.  
  189. PUBLIC void SetTagItem( struct TagItem *taglist, ULONG tag, ULONG value );
  190. PUBLIC void SetTagPair( struct TagItem *taglist, ULONG tag, ULONG value );
  191.  
  192. // ---------------------------------------------------------------------
  193.  
  194. PUBLIC char *FGetS( char *buffer, int length, FILE *stream );
  195.  
  196. PUBLIC unsigned int MakeHexASCIIStr( char *out, char *input, int inlen );
  197.  
  198. PUBLIC char *Byt2Str( char *out, UBYTE input );
  199.  
  200. #endif
  201.  
  202. /* ---------------- END of CommonFuncs.h file! ------------------ */
  203.